Skip to content

Conversation

@Custard7
Copy link
Collaborator

Overview

🎟 Relevant Jira Issues

📚 What is the context and goal of this PR?

🥴 TL; RL:

💡 Feature Breakdown (screenshots & videos encouraged!)

🛠 Important tradeoffs made:

🔍 Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Chore (refactor, documentation update, etc)

💳 Does This Create Any New Technical Debt? ( If yes, please describe and add JIRA TODOs )

  • No
  • Yes

Testing

🔬 How Can Someone QA This?

📱 🖥 Which devices would you like help testing on?

🧪 Code Coverage

Documentation

📜 Gitbook

📊 Storybook

✅ PR Checklist

  • Related to a Jira issue (create one if not)
  • My code follows style guidelines (eslint / prettier)
  • I have manually tested common end-2-end cases
  • I have reviewed my code
  • I have commented my code, particularly where ambiguous
  • New and existing unit tests pass locally with my changes
  • I have made corresponding changes to gitbook documentation

🚀 Ready to squash-and-merge?:

  • Code is backwards compatible
  • There is not a "Do Not Merge" label on this PR
  • I have thoughtfully considered the security implications of this change.
  • This change does not expose new public facing endpoints that do not have authentication

const value = apiTemplateData[varName] || getSmartDefault(varName);

// Escape single quotes in the value
const escapedValue = value.replace(/'/g, "\\'");

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This does not escape backslash characters in the input.

Copilot Autofix

AI 1 day ago

In general, when constructing a language string literal from arbitrary input, you must escape all characters that have special meaning in that literal context, notably backslashes and the quote character used to delimit the string. Here we are building single-quoted JavaScript string literals, so we should escape backslashes first, then escape single quotes. This ensures that any backslash intended to escape the following character in the literal is itself made literal, and our single-quote escaping remains effective.

The best minimal fix is to change the computation of escapedValue in generateTemplateDataCode to first replace backslashes (\) with double backslashes (\\), and then replace single quotes (') with escaped single quotes (\'). This keeps all existing behavior but correctly handles backslashes. Concretely, in apps/learn-card-app/src/pages/appStoreDeveloper/partner-onboarding/steps/DataMappingStep.tsx, around line 663–666, replace the current escapedValue line with two chained replace calls in the proper order:

const escapedValue = value
    .replace(/\\/g, '\\\\')
    .replace(/'/g, "\\'");

No new imports or helper functions are required; we only adjust the escaping logic inside the existing function.

Suggested changeset 1
apps/learn-card-app/src/pages/appStoreDeveloper/partner-onboarding/steps/DataMappingStep.tsx

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/apps/learn-card-app/src/pages/appStoreDeveloper/partner-onboarding/steps/DataMappingStep.tsx b/apps/learn-card-app/src/pages/appStoreDeveloper/partner-onboarding/steps/DataMappingStep.tsx
--- a/apps/learn-card-app/src/pages/appStoreDeveloper/partner-onboarding/steps/DataMappingStep.tsx
+++ b/apps/learn-card-app/src/pages/appStoreDeveloper/partner-onboarding/steps/DataMappingStep.tsx
@@ -660,8 +660,10 @@
             // Use the user-entered value or smart default
             const value = apiTemplateData[varName] || getSmartDefault(varName);
 
-            // Escape single quotes in the value
-            const escapedValue = value.replace(/'/g, "\\'");
+            // Escape backslashes and single quotes in the value for use in a single-quoted JS string literal
+            const escapedValue = value
+                .replace(/\\/g, '\\\\')
+                .replace(/'/g, "\\'");
 
             return `${indent}${varName}: '${escapedValue}',`;
         });
EOF
@@ -660,8 +660,10 @@
// Use the user-entered value or smart default
const value = apiTemplateData[varName] || getSmartDefault(varName);

// Escape single quotes in the value
const escapedValue = value.replace(/'/g, "\\'");
// Escape backslashes and single quotes in the value for use in a single-quoted JS string literal
const escapedValue = value
.replace(/\\/g, '\\\\')
.replace(/'/g, "\\'");

return `${indent}${varName}: '${escapedValue}',`;
});
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
@gitstream-cm
Copy link
Contributor

gitstream-cm bot commented Jan 7, 2026

🥷 Code experts: TaylorBeeston

Custard7, TaylorBeeston have most 👩‍💻 activity in the files.
Custard7, TaylorBeeston have most 🧠 knowledge in the files.

See details

apps/learn-card-app/src/Routes.tsx

Activity based on git-commit:

Custard7 TaylorBeeston
JAN
DEC 26 additions & 0 deletions
NOV 305 additions & 0 deletions
OCT
SEP
AUG

Knowledge based on git-blame:
TaylorBeeston: 92%
Custard7: 8%

apps/learn-card-app/src/components/credentials/OBv3CredentialBuilder.tsx

Activity based on git-commit:

Custard7 TaylorBeeston
JAN
DEC 714 additions & 0 deletions
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
Custard7: 100%

apps/learn-card-app/src/index.scss

Activity based on git-commit:

Custard7 TaylorBeeston
JAN
DEC 1 additions & 0 deletions
NOV 84 additions & 0 deletions
OCT
SEP
AUG

Knowledge based on git-blame:
TaylorBeeston: 100%

apps/learn-card-app/src/pages/appStoreDeveloper/components/AppStoreHeader.tsx

Activity based on git-commit:

Custard7 TaylorBeeston
JAN
DEC 78 additions & 0 deletions
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
Custard7: 100%

apps/learn-card-app/src/pages/appStoreDeveloper/components/IntegrationGuidePanel.tsx

Activity based on git-commit:

Custard7 TaylorBeeston
JAN
DEC 1497 additions & 0 deletions
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
Custard7: 100%

pnpm-lock.yaml

Activity based on git-commit:

Custard7 TaylorBeeston
JAN 23 additions & 0 deletions
DEC 8974 additions & 8789 deletions 354 additions & 344 deletions
NOV 20593 additions & 9364 deletions
OCT 152 additions & 19 deletions
SEP 837 additions & 295 deletions
AUG 43 additions & 0 deletions

Knowledge based on git-blame:
Custard7: 67%
TaylorBeeston: 18%

services/learn-card-network/brain-service/src/helpers/neo4j.helpers.ts

Activity based on git-commit:

Custard7 TaylorBeeston
JAN
DEC
NOV 98 additions & 17 deletions
OCT 22 additions & 4 deletions
SEP
AUG

Knowledge based on git-blame:
Custard7: 52%
TaylorBeeston: 48%

services/learn-card-network/brain-service/src/routes/boosts.ts

Activity based on git-commit:

Custard7 TaylorBeeston
JAN 22 additions & 2 deletions
DEC 55 additions & 22 deletions 222 additions & 3 deletions
NOV 415 additions & 5 deletions
OCT 11 additions & 3 deletions
SEP 4 additions & 2 deletions
AUG 111 additions & 0 deletions

Knowledge based on git-blame:
Custard7: 68%
TaylorBeeston: 31%

services/learn-card-network/brain-service/src/routes/skill-inputs.ts

Activity based on git-commit:

Custard7 TaylorBeeston
JAN
DEC 1 additions & 1 deletions
NOV 132 additions & 0 deletions
OCT
SEP
AUG

Knowledge based on git-blame:
TaylorBeeston: 99%
Custard7: 1%

services/learn-card-network/brain-service/test/boosts.spec.ts

Activity based on git-commit:

Custard7 TaylorBeeston
JAN
DEC 119 additions & 0 deletions
NOV 555 additions & 20 deletions
OCT
SEP
AUG 1242 additions & 449 deletions

Knowledge based on git-blame:
Custard7: 72%
TaylorBeeston: 27%

services/learn-card-network/brain-service/test/helpers.spec.ts

Activity based on git-commit:

Custard7 TaylorBeeston
JAN
DEC
NOV
OCT
SEP
AUG

Knowledge based on git-blame:
Custard7: 100%

✨ Comment /gs review for LinearB AI review. Learn how to automate it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants